//
//  BookStackCategoryLeftTableView.m
//  ProjectDemo
//
//  Created by IOS3 on 2018/11/2.
//  Copyright © 2018 IOS3. All rights reserved.
//

#import "BookStackCategoryLeftTableView.h"

@interface BookStackCategoryLeftTableView ()<UITableViewDelegate, UITableViewDataSource>

@end

@implementation BookStackCategoryLeftTableView

- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
    self = [super initWithFrame:frame style:style];
    if (self) {
        [self initilaizes];
    }
    return self;
}

- (void)initilaizes {
    self.delegate = self;
    self.dataSource = self;
    [self registerClass:[UITableViewCell class] forCellReuseIdentifier:@"BookStackCategoryLeftTableViewCell"];
}


#pragma mark - delegate & datasource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BookStackCategoryLeftTableViewCell" forIndexPath:indexPath];
    cell.textLabel.text = [NSString stringWithFormat:@"%ld", indexPath.row];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (self.selectIndexPathAt) {
        self.selectIndexPathAt(indexPath);
    }
}

@end
